package com.tlibrary.util;

import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * @Author：wcc
 * @Description：设置一个session  未开网页不可以实现
 * @Date：Create in: 2019/4/22--22:01
 */
@Component
public class Setid implements ApplicationRunner {
    @Override
    public void run(ApplicationArguments args) throws Exception {
//        HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
//        HttpSession session = request.getSession();
//        session.setAttribute("username","嘻嘻cc");
//        session.setAttribute("id","f9876a64-255c-4f05-837a-8a837477ec33");
//        System.out.println(session.getAttribute("username"));
//        System.out.println(session.getAttribute("id"));
    }

}
